<template>
  <div class="speical-container">
    <head-info title="最新折扣" operation="查看更多" />
    <div class="priceBox">
      <price-item
        v-for="(item, index) in 4"
        :class="{ priceHidden: true, priceActive: currentIndex === index }"
        style="transition: all 0.5s"
      />
    </div>
    <div class="pageCounter">
      <div class="counter">
        <div
          :class="{ page: true, pageActive: currentIndex === index }"
          v-for="(item, index) in 4"
          :key="index"
          @click="currentIndex = index"
        ></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import priceItem from "@/components/home/specialPrice/priceItem";
import headInfo from "@/components/home/headInfo.vue";

let currentIndex = ref(0);
</script>

<style scoped lang="less">
.speical-container {
  width: 65%;
  .priceBox {
    position: relative;
    padding: 10px;
    width: 100%;
    height: 370px;
    .priceHidden {
      opacity: 0;
    }
    .priceActive {
      opacity: 1;
    }
  }

  .pageCounter {
    display: flex;
    justify-content: center;
    align-items: center;
    .counter {
      display: flex;

      .page {
        margin: 12px 2px;
        width: 25px;
        height: 15px;
        border-radius: 5px;
        transition: background-color 0.2s;
        background-color: rgb(216, 219, 223);
        cursor: pointer;
        &:hover {
          background-color: rgb(172, 172, 187);
        }
      }
      .pageActive {
        background-color: rgb(172, 172, 187);
      }
    }
  }
}
</style>
